#!/usr/bin/R

#Author: Michael Pascal Joergler
#Date: 22.10.2013
#Version: 1
#Description: Script solving EAA week 7 lab task - calculating Service Demand from mpstat datadump

getDi <- function(cpudata){
	idle <- cpudata[,"V11"]
	Di = (100-idle)/1
	return(Di)
}

#read data and get Service Demand
cpudata <- read.table("./temp_week7.dat", skip=3)
Di <- getDi(cpudata)

#plotting Service Demand over time
plot(Di, type="l",ylab="Service Demand",xlab="Time [s]")
abline(h=mean(Di),v=0)
